<?php

    $status = (null) ? 'closed' : 'open';
    $url = 'index.php?dir=' . $dir . '&sub=' . $sub;
    
    if ($guests) {
	
	echo '<h4 class="' . $status . '" onclick="swap(this);">Guests (' . sizeof($guests) . ')</h4>';
	echo '<div>';
        echo '<table><tbody>';
        
        echo '<tr><th>#</th><th>ID</th><th>Name</th><th>Events</th>'; //<th>+</th><th>-</th><th>?</th><th>!</th><th>Polls</th></tr>';
	
        foreach ($guests as $i=>$guest) {
            echo '<tr>';
            echo '<td>' . $i . '</td>';
            echo '<td>' . $guest->getId() . '</td>';
            echo '<td><a href"#">' . $guest->getName() . '</a></td>';
            echo '<td>' . $guest->getEventCount() . '</td>';
            /*
            echo '<td>' . $guest->getAttending() . '</td>';
            echo '<td>' . $guest->getNotAttending() . '</td>';
            echo '<td>' . $guest->getUnsure() . '</td>';
            echo '<td>' . $guest->getUnResponded() . '</td>';
            echo '<td>' . $guest->getPolls() . '</td>'
             */
            echo '</tr>';
        }
        echo '</tbody></table>';
        
    } else {
	
	echo '<h4>There are no Guests!</h4>';
	echo '<div>';

    }
    echo '</div>';
    echo '<button class="create" onclick="window.location="' . $url . '&act=edit">Add Guest</button>';
    
?>